package main

import (
	"fmt"

	"net/http"
	"net/http/httptest"
)

func main() {
	b()
}

func b() {
	req := httptest.NewRequest(http.MethodGet, "/", nil)

	w := httptest.NewRecorder()

	sayHello(w, req)

	fmt.Println(w.Code)

}

func a() {
	ts := httptest.NewServer(http.HandlerFunc(sayHello))
	defer ts.Close()
	// client := ts.Client()
	fmt.Println(ts.URL)
	ts.Client().Get(ts.URL)
}

func sayHello(w http.ResponseWriter, r *http.Request) {
	w.Write([]byte("hello, world"))

}
